const baseURL = process.env.VUE_APP_MAINTENANCE_API;
const uploadURL = process.env.VUE_APP_COMMON_API;
import axios from '@/utils/request';

// 获取报警通知列表
const getSpecificationdata = data =>  axios.request({
  method: 'GET',
  url: baseURL + '/maintenance/getAlarmNoticeList',
  params: data,
  headers: {
      'Content-Type': 'application/json',
      hideLoading: true
  }
});

// 获取自定义列表
const getCustomField = data =>  axios.request({
  method: 'GET',
  url: baseURL + '/maintenance/getDefinedFieldList',
  params: data,
  headers: {
    'Content-Type': 'application/json',
    hideLoading: true
  }
});

// 获取报警工单详情
const getAlarmDetail = data =>  axios.request({
  method: 'GET',
  url: baseURL + '/maintenance/getOrderDetails',
  params: data,
  headers: {
    'Content-Type': 'application/json',
    hideLoading: true
  }
});

// 获取确认通知信息
const confrimInfo = data =>  axios.request({
  method: 'PUT',
  url: baseURL + '/maintenance/confirmAlarmNotice',
  data: data,
  headers: {
    'Content-Type': 'application/json',
    hideLoading: true
  }
});

// 转工单
const transOrder = data =>  axios.request({
  method: 'POST',
  url: baseURL + '/maintenance/createOrder',
  data: data,
  headers: {
    'Content-Type': 'application/json',
    hideLoading: true
  }
});

// 获取通知详情
const getConfrimInfo = data =>  axios.request({
  method: 'GET',
  url: baseURL + '/maintenance/getAlarmNoticeDetail',
  params: data,
  headers: {
    'Content-Type': 'application/json',
    hideLoading: true
  }
});

// 上传图片
const uploadImg = data =>  axios.request({
  method: 'POST',
  url: uploadURL + '/uploadFile',
  data: data,
  headers:{
    "Content-Type":"multipart/form-data",
    hideLoading: false
  }
});

// 获取现场联系人
const getLinkePerson = data =>  axios.request({
  method: 'GET',
  url: baseURL + '/maintenance/getDeviceLastContact',
  params: data,
  headers: {
    'Content-Type': 'application/json',
    hideLoading: true
  }
});

// 通知忽略
const ignoreNotice = data =>  axios.request({
  method: 'PUT',
  url: baseURL + '/maintenance/neglectAlarmNotice',
  data: data,
  headers:{
    "Content-Type":"application/json",
    hideLoading: true
  }
});

// 设置自定义列表
const setCustomField = data =>  axios.request({
  method: 'POST',
  url: baseURL + '/maintenance/setDefinedFieldList',
  data: data,
  headers: {
    'Content-Type': 'application/json',
    hideLoading: true
  }
});

// 延时通知
const delayData = data =>  axios.request({
  method: 'PUT',
  url: baseURL + '/maintenance/delayAlarmNotice',
  data: data,
  headers: {
    'Content-Type': 'application/json',
    hideLoading: true
  }
});

// 转工单
const transOrderId = data =>  axios.request({
  method: 'PUT',
  url: baseURL + '/maintenance/transferAlarmOrder',
  data: data,
  headers: {
    'Content-Type': 'application/json',
    hideLoading: true
  }
});

export { getSpecificationdata,getCustomField, getLinkePerson, transOrderId, getAlarmDetail, delayData, ignoreNotice, setCustomField,getConfrimInfo,confrimInfo, uploadImg,transOrder }
